﻿namespace SERFLITEMAX20.Viewer
{
    using System;
    using System.ComponentModel;
    using System.Drawing;
    using System.Runtime.CompilerServices;
    using System.Windows.Forms;

    public class frmStatus : Form
    {
        private ToolStripMenuItem clearToolStripMenuItem;
        private ColumnHeader columnHeader1;
        private ColumnHeader columnHeader5;
        private IContainer components = null;
        private ContextMenuStrip contextMenuStrip1;
        private ListView lstStatus;
        private Splitter splitter1;
        private TextBox txtStatus;

        public frmStatus()
        {
            this.InitializeComponent();
        }

        private void clearToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.lstStatus.Items.Clear();
            this.txtStatus.Text = "";
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        private void InitializeComponent()
        {
            this.components = new System.ComponentModel.Container();
            this.txtStatus = new System.Windows.Forms.TextBox();
            this.splitter1 = new System.Windows.Forms.Splitter();
            this.lstStatus = new System.Windows.Forms.ListView();
            this.columnHeader1 = new System.Windows.Forms.ColumnHeader();
            this.columnHeader5 = new System.Windows.Forms.ColumnHeader();
            this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
            this.clearToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.contextMenuStrip1.SuspendLayout();
            this.SuspendLayout();
            // 
            // txtStatus
            // 
            this.txtStatus.Dock = System.Windows.Forms.DockStyle.Bottom;
            this.txtStatus.Location = new System.Drawing.Point(0, 219);
            this.txtStatus.Multiline = true;
            this.txtStatus.Name = "txtStatus";
            this.txtStatus.ReadOnly = true;
            this.txtStatus.ScrollBars = System.Windows.Forms.ScrollBars.Both;
            this.txtStatus.Size = new System.Drawing.Size(689, 85);
            this.txtStatus.TabIndex = 2;
            // 
            // splitter1
            // 
            this.splitter1.Dock = System.Windows.Forms.DockStyle.Bottom;
            this.splitter1.Location = new System.Drawing.Point(0, 209);
            this.splitter1.Name = "splitter1";
            this.splitter1.Size = new System.Drawing.Size(689, 10);
            this.splitter1.TabIndex = 26;
            this.splitter1.TabStop = false;
            // 
            // lstStatus
            // 
            this.lstStatus.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            this.lstStatus.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
            this.columnHeader1,
            this.columnHeader5});
            this.lstStatus.ContextMenuStrip = this.contextMenuStrip1;
            this.lstStatus.Dock = System.Windows.Forms.DockStyle.Fill;
            this.lstStatus.FullRowSelect = true;
            this.lstStatus.GridLines = true;
            this.lstStatus.HideSelection = false;
            this.lstStatus.LabelEdit = true;
            this.lstStatus.Location = new System.Drawing.Point(0, 0);
            this.lstStatus.Name = "lstStatus";
            this.lstStatus.Size = new System.Drawing.Size(689, 209);
            this.lstStatus.TabIndex = 27;
            this.lstStatus.UseCompatibleStateImageBehavior = false;
            this.lstStatus.View = System.Windows.Forms.View.Details;
            this.lstStatus.SelectedIndexChanged += new System.EventHandler(this.lstStatus_SelectedIndexChanged);
            // 
            // columnHeader1
            // 
            this.columnHeader1.Name = "columnHeader1";
            this.columnHeader1.Text = "Date";
            this.columnHeader1.Width = 139;
            // 
            // columnHeader5
            // 
            this.columnHeader5.Text = "Message";
            this.columnHeader5.Width = 529;
            // 
            // contextMenuStrip1
            // 
            this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
            this.clearToolStripMenuItem});
            this.contextMenuStrip1.Name = "contextMenuStrip1";
            this.contextMenuStrip1.Size = new System.Drawing.Size(111, 26);
            // 
            // clearToolStripMenuItem
            // 
            this.clearToolStripMenuItem.Name = "clearToolStripMenuItem";
            this.clearToolStripMenuItem.Size = new System.Drawing.Size(110, 22);
            this.clearToolStripMenuItem.Text = "Clear";
            this.clearToolStripMenuItem.Click += new System.EventHandler(this.clearToolStripMenuItem_Click);
            // 
            // frmStatus
            // 
            this.ClientSize = new System.Drawing.Size(689, 304);
            this.Controls.Add(this.lstStatus);
            this.Controls.Add(this.splitter1);
            this.Controls.Add(this.txtStatus);
            this.Name = "frmStatus";
            this.Text = "Status";
            this.contextMenuStrip1.ResumeLayout(false);
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        private void lstStatus_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (this.lstStatus.SelectedItems.Count > 0)
            {
                this.txtStatus.Text = this.lstStatus.SelectedItems[0].SubItems[1].Text;
            }
        }

        public void UpdateStatus(string pStatus)
        {
            if (base.InvokeRequired)
            {
                delegateUpdateStatus method = new delegateUpdateStatus(this.UpdateStatus);
                base.Invoke(method, new object[] { pStatus });
            }
            else
            {
                this.lstStatus.Items.Add(DateTime.Now.ToString()).SubItems.Add(pStatus);
            }
        }

        public void View()
        {
            base.Show();
        }

        private delegate void delegateUpdateStatus(string pStatus);
    }
}

